using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DTO;
using BUS;
using DAL;
using Utility;

public partial class Admin_giaodichkhachhang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    private void LoadData()
    {
        int total = 0;
        Criteria cri = new Criteria();
        //PagerV2_8_1.PageSize = int.Parse(ConfigurationManager.AppSettings["pagesize"]);
        Repeater1.DataSource = tbtkkhBUS.GET(cri.Criter, 0, 1, tbtkkhDTOColumn.Tkkhachhang.ToString(), OrderDirection.ASC.ToString(), out total);
        Repeater1.DataBind();
        //PagerV2_8_1.ItemCount = total;
        //if (PagerV2_8_1.ItemCount <= PagerV2_8_1.PageSize)
        //    PagerV2_8_1.Visible = false;
        //else
        //    PagerV2_8_1.Visible = true;
    }
    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {

            tbtkkhDTO tkkh = (tbtkkhDTO)e.Item.DataItem;


            tbkhachhangDTO kh = tbkhachhangBUS.GetByID(tkkh.Makh);
            if (kh != null)
            {
                Literal lit_khachhang = (Literal)e.Item.FindControl("lit_kh");
                lit_khachhang.Text = kh.Tenkh;
            }
            HyperLink hyp_tk = (HyperLink)e.Item.FindControl("hyp_tkkh");
            hyp_tk.Text = tkkh.Tkkhachhang.ToString();
            hyp_tk.NavigateUrl = "khachhangct.aspx?id=" + tkkh.Tkkhachhang.ToString();
        }
        
    }
}
